home *** CD-ROM | disk | FTP | other *** search
- Path: news.rain.org!usenet
- From: "Guus Leeuw jr." <guusl@eiffel.com>
- Newsgroups: comp.lang.c++
- Subject: Re: HELP - templates won't compile via Project files...
- Date: Sat, 02 Mar 1996 11:01:52 -0800
- Organization: Interactive Software Engineering Inc. http://www.eiffel.com/
- Message-ID: <31389B20.587AAB7F@eiffel.com>
- References: <4h8t4b$oi3@wintermute.ecs.fullerton.edu>
- NNTP-Posting-Host: @outback.eiffel.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (X11; I; Linux 1.2.8 i586)
-
- Gil Rosin wrote:
- >
- > The title says it all, I'm a newbie to C++ and wrote a stack package that
- > just did integers, well, I recently tried to convert it to a template.
- >
- > Anyways, when I try to compile it, I get linker errors saying that the
- > functions can not be found, yet they EXIST!
- >
- > I only get those errors for functions that are defined out of line, for example
- > I have 3 files:
- >
- > STACK.H - class declaration
- > STACK.CPP - a few STACK functions
- > TEST.CPP - the driver
- >
- > I have most of the functions defined inline because they are small, but 3
- > I have out of line, Push, Pop and Flush.
- >
- > Anyways, in stack.h, I define them in the class like:
- >
-
- [ CODE SNIPPED ]
-
- >
- > when I compile it in a project file in Borland C++ v3.1, It compiles ok, but
- > I get 3 linker errors:
- >
- > undefined symbol Flush........
- > undefined symbol Push.... in TEST.CPP
- > ....
- >
- > etc. BUT here's the kicker, when I lump all the 3 files into one file and THEN
- > compile the one file, everything works fine, what is going on here?
- >
-
- Some compiler don't include the template source file automatically. You will have to it
- manually, thru the #include preprocessor directive.
-
- Regards,
- Guus
-
- PS: If want an answer you should read this group, not your mailbox... ;-)
-